package com.station.controller;

import com.station.service.OtherOutService;
import com.station.service.SaleOrderService;
import com.station.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Description: 订单同步
 * @Author: dongfangyu
 * @Date: 2025/10/14
 */
@RestController
@RequestMapping("/syncOrder")
public class SyncOrderController {

    @Autowired
    private SaleOrderService saleOrderService;
    @Autowired
    private OtherOutService otherOutService;

    /**
     * 批量同步直销订单
     * @param startDate
     * @param endDate
     * @return
     */
    @GetMapping("/syncSaleOrder")
    public R syncSaleSaleOrder(String startDate, String endDate) {
        R r = saleOrderService.syncSaleOrder(startDate, endDate);
        return r;
    }

    /**
     * 批量同步核销订单
     * @param startDate
     * @param endDate
     * @return
     */
    @GetMapping("/syncVerifyOrder")
    public R syncVerifyOrder(String startDate, String endDate) {
        R r = saleOrderService.syncVerifyOrder(startDate, endDate);
        return r;
    }

    /**
     * 批量同步直销订单收款单
     * @param startDate
     * @param endDate
     * @return
     */
    @GetMapping("/syncSaleReceipt")
    public R syncSaleReceipt(String startDate, String endDate) {
        R r = saleOrderService.syncSaleReceipt(startDate, endDate);
        return r;
    }

    /**
     * 批量同步核销订单收款单
     * @param startDate
     * @param endDate
     * @return
     */
    @GetMapping("/syncReceipt")
    public R syncReceipt(String startDate, String endDate) {
        R r = saleOrderService.syncReceipt(startDate, endDate);
        return r;
    }

    /**
     * 批量同步领用单
     * @param startDate
     * @param endDate
     * @return
     */
    @GetMapping("/syncUsedOrder")
    public R syncUsedOrder(String startDate, String endDate) {
        R r = otherOutService.syncUsedOrderList(startDate, endDate);
        return r;
    }

    /**
     * 批量同步退货单
     * @param startDate
     * @param endDate
     * @return
     */
    @GetMapping("/syncRefundOrder")
    public R syncRefundOrder(String startDate, String endDate) {
        R r = saleOrderService.syncRefundOrder(startDate, endDate);
        return r;
    }
}
